package com.winshare.saleAssistant.domain.entity;

import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.List;

@Data
public class StaffDO {

    private Integer id;

    private String account;

    private String staffName;

    private String phone;

    private Integer isActive;

    private String orgCode;

    private String orgName;

    private Integer orgId;

    private String roleName;

    private String salt;

    private String password;

    private Integer isApprovalPerson;

    private String lastLoginTime;

    private String openId;

    private Integer isSubscribe;

    private Integer isStudy;

    private String imageUrl;

    private Integer isReadPassword;

    private String readPassword;

    private String role;

    private String appRole;

    private List<RoleDO> roleList;

    private List<AppRoleDO> appRoleList;

    private String sourceType;

    private Integer readCount;

    private Integer promotionCount;

    private Integer articleReadCount;

    private Integer articlePromotionCount;

    private Integer loginCount;

    private Integer isChangeModel;

    private String activeTime;


    public StaffDO() {
    }

    public String getCredentialsSalt() {
        if (StringUtils.isEmpty(account)) {
            throw new IllegalArgumentException("set account before.");
        }
        if (StringUtils.isEmpty(salt)) {
            throw new IllegalArgumentException("set salt before.");
        }
        return account + salt;
    }
}
